#ifndef SESSION_TREE_VIEW_MODEL_H
#define SESSION_TREE_VIEW_MODEL_H

#include <QAbstractItemModel>
#include <QIcon>
#include "utils.h"
#include "session_tree_item.h"

class CSessionTreeViewModel : public QAbstractItemModel
{
public:
    CSessionTreeViewModel(QObject *parent = nullptr);
   ~CSessionTreeViewModel();
public:
    CSessionTreeItem *root();

    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    QModelIndex index(int row, int column, const QModelIndex &parent) const;
    QModelIndex parent(const QModelIndex &child) const;
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;

 public:
    CSessionTreeItem *itemFromIndex(const QModelIndex &index) const;
    void insertItem(CSessionTreeItem,QModelIndex index);                     //插入子数据
    void delTiem(QModelIndex index);
private:
     CSessionTreeItem *m_rootItem;  // 第一个节点,临时数据
     QIcon *m_icon;


};

#endif // SESSION_TREE_VIEW_MODEL_H
